package k4_thread.demo02;

import java.util.Random;

public class DownloadFileByEasy {


    public static void main(String[] args) {

        Random random = new Random();

        new Thread(()->{
            try {
                for (int i = 1; i <=100 ; i++) {
                    System.out.println(Thread.currentThread().getName()+" 下载了 "+i+"%");
                    Thread.sleep(random.nextInt(500)+100);
                }
            }catch (Exception e){
                e.printStackTrace();
            }
        },"java从入门到精通").start();

        new Thread(()->{
            try {
                for (int i = 1; i <=100 ; i++) {
                    System.out.println(Thread.currentThread().getName()+" 下载了 "+i+"%");
                    Thread.sleep(random.nextInt(500)+100);
                }
            }catch (Exception e){
                e.printStackTrace();
            }
        },"高血压的预防").start();

        new Thread(()->{
            try {
                for (int i = 1; i <=100 ; i++) {
                    System.out.println(Thread.currentThread().getName()+" 下载了 "+i+"%");
                    Thread.sleep(random.nextInt(500)+100);
                }
            }catch (Exception e){
                e.printStackTrace();
            }
        },"活着").start();


    }


}
